<?php
namespace catchAdmin\news\controller;

use app\common\business\Message;
use catcher\CatchResponse;
use catcher\base\CatchRequest;
use catcher\base\CatchController;
use app\common\model\PushMessage as PushMessageModel;

class News extends CatchController
{
    /**
     * 消息列表
     * @time 2023年08月01日
     * @return \think\response\Json
     */
    public function index(): \think\response\Json
    {
        $userInfo = request()->user();
        $where[] = ['creator_id', '=', $userInfo['id']];
        $where[] = ['category', '=', 'Doctor'];
        return CatchResponse::paginate((new PushMessageModel())->getLists($where));
    }

    /**
     * 消息统计
     * @time 2023年08月01日
     * @return \think\response\Json
     */
    public function statistics(): \think\response\Json
    {
        return CatchResponse::success((new Message())->getMessageStatistics());
    }
}